// 导入 相关的控件
import 'package:flutter/material.dart';
// 入口函数
void main() {
  runApp(MyApp());
}
// 无状态控件     有状态控件
class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
     // 每个项目最外层，必须有 MaterialApp
    return MaterialApp(
      title: '豆瓣影视111',
      theme: ThemeData(
       
        primarySwatch: Colors.pink,
        
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHome(),
    );
  }
}

class MyHome extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // 在 Flutter 中，每个控件，都是一个 类
    return DefaultTabController(
      length: 3, 
      child: Scaffold(
      appBar: AppBar(
        title:Text('电影列表'),
        centerTitle: true,
        actions: [
          IconButton(
            icon:Icon(Icons.search),
            onPressed: (){},
          )
        ],
      ),
      drawer: Drawer(
        child:ListView(
          children: [
            UserAccountsDrawerHeader(
              accountEmail: Text('abc@163.com'),
              accountName: Text('李四'),
              currentAccountPicture: CircleAvatar(
                backgroundImage: NetworkImage('https://mat1.gtimg.com/pingjs/ext2020/qqindex2018/dist/img/qq_logo_2x.png'),
              ),
              decoration: BoxDecoration(
                image:DecorationImage(
                  fit:BoxFit.cover,
                  image:NetworkImage(
                    'https://www.lut.cn/images/DSC_6356_.jpg'
                  )
                )
              )
            ),
            ListTile(title: Text('用户反馈'),trailing: Icon(Icons.feedback)),
            ListTile(
                title: Text('系统设置'),
                trailing: Icon(Icons.settings),
              ),
              ListTile(
                title: Text('我要发布'),
                trailing: Icon(Icons.send),
              ),
              // 分割线控件
              Divider(),
              ListTile(
                title: Text('注销'),
                trailing: Icon(Icons.exit_to_app),
              )
          ],
        )
      ),
      bottomNavigationBar: Container(
        // 一般高度都是50
        height:50,
        /* 美化当前的 Container 盒子*/
        decoration: BoxDecoration(color: Colors.black),
        child:TabBar(
          labelStyle:TextStyle(height: 0, fontSize: 10) ,
          tabs: [
              Tab(
                icon: Icon(Icons.movie_filter),
                text: '正在热映',
              ),
              Tab(
                icon: Icon(Icons.movie_creation),
                text: '即将上映',
              ),
              Tab(
                icon: Icon(Icons.local_movies),
                text: 'Top250',
              )
        ])
       )
      )
      );
  }
}
